{extend name="$base" /}
{block name="resources"}{/block}
{block name="right_tab"}{/block}
{block name="main"}
<table class="mytable">
    <tr>
        <th width="20%" style="text-align: left;">

        </th>
        <th  class="default-condition">
            <select class="select-common middle" id="category_id">
                <option value="0">请选择品类</option>
                {volist name="category_list" id="category"}
                <option value="{$category.category_id}">{$category.category_name}</option>
                {/volist}
            </select>
            <input type="button" onclick="LoadingInfo(1)" value="搜索" class="btn-common" />
        </th>
    </tr>
</table>
<div class="mod-table">
    <div class="mod-table-head">
        <div class="con style0list">
            <table class="table-class">
                <colgroup>
                    <col style="width: 6%;">
                    <col style="width: 30%;">
                    <col style="width: 30%;">
                    <col style="width: 20%;">
                    <col style="width: 14%;">
                </colgroup>
                <thead>
                <tr>
                    <th><i class="checkbox-common"><input type="checkbox"  ></i></th>
                    <th>产品名称</th>
                    <th>所属品类</th>
                    <th>红旗手数量</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody></tbody>
            </table>
        </div>
    </div>
</div>
{/block}
{block name="script"}
{include file="admin/pageCommon" /}
<script type="text/javascript">
    //加载数据
    function LoadingInfo(page_index) {
        var category_id = $("#category_id").val();
        $.ajax({
            type : "post",
            url : "{:__URL('AGENT_MAIN/stat/goods')}",
            data : {
                "page_index" : page_index,
                "page_size" : $("#showNumber").val(),
                "category_id" : category_id
            },
            success : function(data) {
                $("#page_count").val(data["page_count"]);
                $("#pageNumber a").remove();
                var html = '';
                if (data["data"].length > 0) {
                    for (var i = 0; i < data["data"].length; i++) {
                        html += '<tr align="center">';
                        html += '<td><div class="cell"><i class="checkbox-common"><input name="sub" type="checkbox" value="'+ data["data"][i]["level_id"] +'" ></i></div></td>';
                        html += '<td>' + data["data"][i]["goods_name"] + '</td>';
                        html += '<td>' + data["data"][i]["category_name"] + '</td>';
                        html += '<td>' + data["data"][i]["middle_num"] + '</td>';
                        html += '<td>';
                            html +=	'<a href="'+__URL('AGENT_MAIN/stat/promoter?goods_id='+ data["data"][i]["goods_id"])+'">查看明细</a>';
                        html +=	'</td> ';
                        html += '</tr>';
                    }
                    html += '<tr align="left"><td colspan="4">红旗手总数统计：'+ data['total_middle_num'] +'</td></tr>';
                } else {
                    html += '<tr align="center"><td colspan="4">暂无符合条件的数据记录</td></tr>';
                }

                $(".style0list tbody").html(html);
                initPageData(data["page_count"],data['data'].length,data['total_count']);
                $("#pageNumber").html(pagenumShow(jumpNumber,$("#page_count").val(),{$pageshow}));
            }
        });
    }
    //全选
    function CheckAll(event){
        var checked = event.checked;
        $(".style0list tbody input[type = 'checkbox']").prop("checked",checked);
    }

</script>
{/block}